Skip to content

[3.12] gh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (GH-145589)#145809

Merged
Yhg1s merged 2 commits into
python:3.12from
encukou:backport-16dbbe5-3.12
Apr 15, 2026
Merged

[3.12] gh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (GH-145589)#145809
Yhg1s merged 2 commits into
python:3.12from
encukou:backport-16dbbe5-3.12

Conversation

@encukou

@encukou encukou commented Mar 11, 2026

Copy link
Copy Markdown
Member

Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
(cherry picked from commit 6c8c72f)

Includes fix-up from 26326a0 (GH-145735)

Co-authored-by: Victor Stinner vstinner@python.org

miss-islington and others added 2 commits March 11, 2026 13:40
…ythonGH-145589) (pythonGH-145594)

pythongh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (pythonGH-145589)

Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
(cherry picked from commit 6c8c72f)
(cherry picked from commit 16dbbe5)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
…honGH-145735)

VMADDR_CID_LOCAL was added to `socekt` in 3.14. The test needs a
local constant in setUp(), as in clientSetUp().

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I tested the change manually on Fedora Stable x86-64, ./python -m test test_socket -m ThreadedVSOCKSocketStreamTest -v pass successfully, and ./python -m test.pythoninfo works as expected (it logs test_socket.get_cid: 4294967295).

@vstinner

Copy link
Copy Markdown
Member

The test also exists on 3.10 and 3.11, we might need to backport the change there as well.

@encukou

encukou commented Mar 11, 2026

Copy link
Copy Markdown
Member Author

The test also exists on 3.10 and 3.11, we might need to backport the change there as well.

Yes. I set the labels here, so that miss-islington includes the fix-up.

@Shrey-N

Shrey-N commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Hiya @encukou
Here the socket prefix is missing, I think if it is a constant from the socket module, it should be namespaced. Otherwise, it couldn't safely fall back in case older systems do not have it defined.

@vstinner

Copy link
Copy Markdown
Member

Here the socket prefix is missing, I think if it is a constant from the socket module, it should be namespaced.

I added socket.VMADDR_CID_LOCAL constant in Python 3.14. On Python 3.13 and older, the VMADDR_CID_LOCAL constant is only defined in test_socket.py.

@Shrey-N

Shrey-N commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Ah, Thank you for the clarification :) I just realised that I didn't see the 3.12 tag

@encukou

encukou commented Mar 17, 2026

Copy link
Copy Markdown
Member Author

!buildbot AMD64.Fedora

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit 9f1b62f 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F145809%2Fmerge

The command will test the builders whose names match following regular expression: AMD64.Fedora

The builders matched are:

  • AMD64 Fedora Stable Clang Installed PR
  • AMD64 Fedora Rawhide Clang PR
  • AMD64 Fedora Rawhide Clang Installed PR
  • AMD64 Fedora Stable Clang PR
  • AMD64 Fedora Stable LTO PR
  • AMD64 Fedora Rawhide NoGIL refleaks PR
  • AMD64 Fedora Stable LTO + PGO PR
  • AMD64 Fedora Stable PR
  • AMD64 Fedora Rawhide NoGIL PR
  • AMD64 Fedora Rawhide LTO PR
  • AMD64 Fedora Stable Refleaks PR
  • AMD64 Fedora Rawhide PR
  • AMD64 Fedora Rawhide Refleaks PR
  • AMD64 Fedora Rawhide LTO + PGO PR

@encukou

encukou commented Mar 19, 2026

Copy link
Copy Markdown
Member Author

@Yhg1s, this test-only patch should fix the buildbot failures on 3.12.

@Yhg1s Yhg1s merged commit e378eda into python:3.12 Apr 15, 2026
47 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @encukou for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington added a commit to miss-islington/cpython that referenced this pull request Apr 15, 2026
…ythonGH-145589) (pythonGH-145809)

* [3.12] pythongh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (pythonGH-145589) (pythonGH-145594)

Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
(cherry picked from commit 6c8c72f)
(cherry picked from commit 16dbbe5)

* [3.13] pythongh-145548: Don't use VMADDR_CID_LOCAL from `socket` (pythonGH-145735)

VMADDR_CID_LOCAL was added to `socekt` in 3.14. The test needs a
local constant in setUp(), as in clientSetUp().
(cherry picked from commit e378eda)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app

bedevere-app Bot commented Apr 15, 2026

Copy link
Copy Markdown

GH-148616 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.11 only security fixes label Apr 15, 2026
miss-islington added a commit to miss-islington/cpython that referenced this pull request Apr 15, 2026
…ythonGH-145589) (pythonGH-145809)

* [3.12] pythongh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (pythonGH-145589) (pythonGH-145594)

Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
(cherry picked from commit 6c8c72f)
(cherry picked from commit 16dbbe5)

* [3.13] pythongh-145548: Don't use VMADDR_CID_LOCAL from `socket` (pythonGH-145735)

VMADDR_CID_LOCAL was added to `socekt` in 3.14. The test needs a
local constant in setUp(), as in clientSetUp().
(cherry picked from commit e378eda)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app

bedevere-app Bot commented Apr 15, 2026

Copy link
Copy Markdown

GH-148617 is a backport of this pull request to the 3.10 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.10 only security fixes label Apr 15, 2026
@encukou encukou deleted the backport-16dbbe5-3.12 branch April 15, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants